<template>
  <div>
    <pre v-html="data"></pre>
    <el-row>
      <el-col :span="15">
        <div class="grid-content bg-purple">
          <el-input v-model="id" placeholder="请输入数据ID获取数据"></el-input>
        </div>
      </el-col>
      <el-col :span="1">
        &nbsp;
      </el-col>
      <el-col :span="8">
        <el-button size="mini" type="primary" @click="onSubmit"
        >立即获取</el-button
        >
      </el-col>
    </el-row>

    <pre v-html="row"></pre>
  </div>
</template>

<script>
  import { ajax } from "@/store/yg/common/utils";

  export default {
    props: ["data"],
    data() {
      return {
        id: "",
        row: ""
      };
    },
    methods: {
      onSubmit() {
        if ("" === this.id) {
          return;
        }
        var data = {};
        var attrs = {};
        data["id"] = this.id;
        attrs['class'] = this.$store.state.blank.entry.client.class;
        ajax("request", data, attrs).then(
          res => {
            this.row = res;
          },
          error => {
            console.log(error);
          }
        );
      }
    }
  };
</script>
